[Service Bus] Change getter of boolean values to isXyz()#15890
[Service Bus] Change getter of boolean values to isXyz()#15890YijunXieMS merged 7 commits intoAzure:masterfrom
Conversation
|
The changes in this PR are not necessarily applicable only to Java. The other languages we are working on for Service Bus should be considered as well. |
ramya-rao-a
left a comment
There was a problem hiding this comment.
My conclusions after multiple discussions on this subject:
We are not too keen on being consistent between the "Enable" and "Requires" prefixes as matching with what goes over the wire trumps the small win of being consistent with the prefixes. This would not hold true for cases where the name is way too bad in the first place, but we do not find any such instances for Service Bus at the moment.
Unlike other languages, Java has getters and setters with get/set prefixes. For boolean return types, is is preferred instead of get. Since most of the properties do not read well if we just added is prefix, we will be taking the liberty to reword the names of these properties to help with readability. These will not match exactly with what goes over the wire, but will have similar words, so that should not be a problem. The win to readability trumps for Java due to the necessity to have separate prefixes for the getters and setters.
My mistake was to assume that the efforts in this PR also included in improving names in general and so would affect other languages.
Having said this, @JonathanGiles and I noticed that we are not updating the setters in this PR. One would expect the setter and getter names to differ only in the prefix i.e. is vs set. Can we have the setters updated here as well?
|
boolean getters and setters suggestion.
|
It's customary to use isXyz() for a boolean value getter than getXyz(), as suggested in issue #14139 . So This PR suggests the following and other similar changes to the public APIs.
enableBatchedOperations() -> isBatchedOperationsEnabled()
enablePartitioning() -> isPartitioningEnabled()
deadLetteringOnMessageExpiration -> isDeadLetteringOnMessageExpiration()
requiresDuplicateDetection() -> isDuplicateDetectionRequired()
supportsOrdering() -> isOrderingSupported()
ServiceBusAdministrationClienthasgetQueueExists(String queueName)and other similar methods. This get method name kept because it implies an HTTP get operation. .Net calls itQueueExists.Closes #14139